/*
    Android UIML

	Copyright (C) 2010  Bram Goffings (bramgoffings@gmail.com)

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public License
	as published by the Free Software Foundation; either version 2.1
	of	the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

package uiml.android.elements;

import java.util.ArrayList;

import org.w3c.dom.Element;

public class Style extends UimlElementWithAttributes{
	
	// TODO comment
	private ArrayList<Property> properties;
	
	// TODO comment
	public static String IAM = "style";
	
	/**
	 * 
	 * @param node
	 */
	public Style(Element node) {
		super(node);
		
		System.out.println("Style element aangemaakt");
		
		process();
	}

	/**
	 * 
	 */
	@Override
	public void processElement(Element elem) {
		if(elem.getTagName().equals(Property.IAM))
			addProperty(new Property(elem));
	}

	/**
	 * 
	 * @param part
	 */
	public void addProperty(Property property) {
		if(properties == null)
			properties = new ArrayList<Property>();
		
		properties.add(property);
	}
	
	/**
	 * 
	 * @return
	 */
	public ArrayList<Property> getProperties() {
		return this.properties;
	}

	public ArrayList<Property> getProperties(String identifier) {
		
		ArrayList<Property> returnProperties= new ArrayList<Property>();
		
		for(Property property : properties)
			if(property.getPartName().equals(identifier))
				returnProperties.add(property);
		
		return returnProperties;
	}
}
